package com.lee.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class HelloServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
        this.doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
        String businessDate = "业务数据....";
        
        resp.setCharacterEncoding("utf-8");
        resp.setContentType("text/html");
        PrintWriter out = resp.getWriter();
        out.write("<html>");
        out.write("<head>");
        out.write("<title>Hello World</title>");
        out.write("</head>");
        out.write("<body>");
        out.write("<h1>Hello World!</h1>");
        out.write("<div><span><strong>");
        out.write(businessDate);
        out.write("</strong></span></div>");
        out.write("</body>");
        out.write("</html>");
        out.flush();
        out.close();
    } 
}